/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
@use '@angular/material' as mat;
@use '@angular/material' as matm2;
@use '@angular/material' as matm2var;
@import 'tensorboard/webapp/theme/tb_theme';

:host {
  @include tb-theme-foreground-prop(color, secondary-text);
  font-size: 12px;
}

section {
  @include tb-theme-foreground-prop(border-bottom, border, 1px solid);
  padding: 16px;
}

.section-title {
  @include tb-theme-foreground-prop(color, text);
  text-transform: uppercase;
  font-weight: 500;
  font-size: 13px;
  line-height: normal;
  margin: 0 0 12px 0;
}

// Add additional margin between most control elements. The exception is when
// the second control row is a checkbox, in which case we just rely on the
// padding that is already included in the checkbox.
section .control-row:not(:has(+ .control-row > mat-checkbox)):not(:last-child) {
  margin-bottom: 12px;
}

.control-name {
  margin-bottom: 8px;
}

.slider-row {
  display: flex;
  align-items: center;
  // Reset mat-slider's internal extra space on top
  // https://github.com/angular/components/blob/master/src/material/slider/slider.scss#L10
  height: 28px;

  .reset-button {
    margin-left: 6px;
  }

  .slider-input {
    background-color: inherit;
    border: 1px solid matm2.get-color-from-palette($tf-slate, 500);
    border-radius: 2px;
    box-sizing: border-box;
    color: inherit;
    height: 100%;
    margin-left: 12px;
    padding: 0 4px;

    @include tb-dark-theme {
      border-color: matm2.get-color-from-palette($tf-slate, 700);
    }
  }
}

.scalars-smoothing .slider-input {
  flex: none;
  // Wide enough to show 3 digits after a decimal. Required since Firefox does
  // not shrink input fields smaller than some intrinsic size.
  width: 5em;
}

.scalars-partition-x {
  align-items: center;
  display: flex;

  .info {
    $_dim: 15px;
    height: $_dim;
    margin-left: 5px;
    width: $_dim;
    min-width: $_dim;
  }
}

mat-checkbox {
  // Counteract the padding of the checkbox in order to align it vertically
  // with other items in the pane.
  margin-left: -11px;

  ::ng-deep label {
    @include tb-theme-foreground-prop(color, secondary-text);
    font-size: 12px;
    letter-spacing: normal;
    padding-left: 0px;
    white-space: nowrap;
  }
}

mat-slider {
  flex: 1;
  // Reset mat-slider's internal extra space on left/right sides
  // https://github.com/angular/components/blob/8a0196786bb6aa09e17ad84c1a2f035fea4fac5a/src/material/slider/slider.scss#L39
  margin-left: 0px;
  margin-right: 0px;
}

.column-edit-menu-toggle {
  align-items: center;
  display: flex;
  cursor: pointer;
  font-size: inherit;
  height: 28px;
  padding-left: 5px;
  padding-right: 12px;

  &.mat-button-wrapper {
    display: inline-flex;
    align-items: center;
  }

  &.toggle-opened {
    background-color: matm2.get-color-from-palette(matm2var.$grey-palette, 200);

    @include tb-dark-theme {
      background-color: matm2.get-color-from-palette(
        matm2var.$grey-palette,
        800
      );
    }
  }

  mat-icon {
    margin-right: 6px;
  }
}

tb-dropdown {
  display: block;
}

.control-row {
  .indent {
    margin-left: 28px;
  }
}
